﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ClientAppViaWebService.BaseLogicServiceRef;
using ClientAppViaWebService.DivisionsLogicServiceRef;
using ClientAppViaWebService.ClubLogicServiceRef;
using ClientAppViaWebService.ManagingDivisionLogicServiceRef;
using ClientAppViaWebService.SectionLogicServiceRef;
using ClientAppViaWebService.ServiceDivisionLogicServiceRef;
using ClientAppViaWebService.OrganizationalDivisionsLogicServiceRef;
using ClientAppViaWebService.RestDivisionLogicServiceRef;
using ClientAppViaWebService.ResearchDivisionsLogicServiceRef;
using ClientAppViaWebService.LaboratoriesLogicServiceRef;
using ClientAppViaWebService.StreamsLogicServiceRef;
using ClientAppViaWebService.GroupsLogicServiceRef;
using ClientAppViaWebService.FacultiesLogicServiceRef;
using ClientAppViaWebService.DepartmentsLogicServiceRef;

namespace ClientAppViaWebService.DBAdministration
{
    public partial class TableAdministrationForm : Form
    {
        private BaseLogicService baseLogicService = new BaseLogicService();
        private DivisionsLogicService divisionLogicService = new DivisionsLogicService();
        private ClubLogicService clubLogicService = new ClubLogicService();
        private ManagingDivisionLogicService manDivLogicService = new ManagingDivisionLogicService();
        private SectionLogicService sectionLogicService  = new SectionLogicService();
        private ServiceDivisionLogicService serviceLogicService = new ServiceDivisionLogicService();
        private OrganizationalDivisionsLogicService orgDivLogicService = new OrganizationalDivisionsLogicService();
        private RestDivisionLogicService restDivisionLogicService = new RestDivisionLogicService();
        private ResearchDivisionsLogicService rschDivLService = new ResearchDivisionsLogicService();
        private LaboratoriesLogicService labLService = new LaboratoriesLogicService();
        private StreamsLogicService strLService = new StreamsLogicService();
        private GroupsLogicService grpLService = new GroupsLogicService();
        private FacultiesLogicService facLService = new FacultiesLogicService();
        private DepartmentsLogicService depLService = new DepartmentsLogicService();
       
        public TableAdministrationForm(string databaseName, string objectName)
        {
            InitializeComponent();
            this.Text = objectName;
            switch (objectName)
            {
                case "TObjects": 
                    dataGridView1.DataSource = baseLogicService.SelectTObjectListByDataBaseName(databaseName); 
                    break;
                case "Divisions": 
                    dataGridView1.DataSource = divisionLogicService.SelectDivisionListByDataBaseName(databaseName); 
                    break;
                case "Clubs": 
                    dataGridView1.DataSource = clubLogicService.SelectClubListByDataBaseName(databaseName); 
                    break;
                case "ManagingDivisions": 
                    dataGridView1.DataSource = manDivLogicService.SelectManagingDivisionListByDataBaseName(databaseName); 
                    break;
                case "OrgDivisions": 
                    dataGridView1.DataSource = orgDivLogicService.SelectOrganizationalDivisionListByDataBaseName(databaseName); 
                    break;
                case "ServiceDivisions": 
                    dataGridView1.DataSource = serviceLogicService.SelectServiceDivisionListByDataBaseName(databaseName); 
                    break;
                case "Sections": 
                    dataGridView1.DataSource = sectionLogicService.SelectSectionListByDataBaseName(databaseName); 
                    break;
                case "RestDivisions": 
                    dataGridView1.DataSource = restDivisionLogicService.SelectRestDivisionListByDataBaseName(databaseName); 
                    break;
                case "ResearchDivisions":
                    dataGridView1.DataSource = rschDivLService.SelectResearchDivisionListByDataBaseName(databaseName);
                    break;
                case "Laboratories":
                    dataGridView1.DataSource = labLService.SelectLaboratoryListByDataBaseName(databaseName);
                    break;
                case "Streams":
                    dataGridView1.DataSource = strLService.SelectStreamListByDataBaseName(databaseName);
                    break;
                case "Groups":
                    dataGridView1.DataSource = grpLService.SelectGroupListByDataBaseName(databaseName);
                    break;
                case "Departments":
                    dataGridView1.DataSource = depLService.SelectDepartmentListByDataBaseName(databaseName);
                    break;
                case "Faculties":
                    dataGridView1.DataSource = facLService.SelectFacultyListByDataBaseName(databaseName);
                    break;
               
            }
        }
    }
}
